package com.leizi.igym.exception;

import com.leizi.igym.enums.ReturnCodeEnum;

/**
 * @Author: leizi0110
 * @CreateTime: 2024-04-02  18:11
 * @Description:
 */

public class BusinessException extends RuntimeException {

    private final int code;

    public BusinessException(int code, String message) {
        super(message);
        this.code = code;
    }

    public BusinessException(ReturnCodeEnum errorCode) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
    }

    public BusinessException(ReturnCodeEnum errorCode, String message) {
        super(message);
        this.code = errorCode.getCode();
    }

    public int getCode() {
        return code;
    }
}
